import random
import sys

def generate_test_case(n, max_val=100):
    """生成测试用例"""
    return [random.randint(-max_val, max_val) for _ in range(n)]

def write_test_case(filename, arr):
    """将测试用例写入文件"""
    with open(filename, 'w') as f:
        f.write(' '.join(map(str, arr)))

def main():
    if len(sys.argv) != 3:
        print("Usage: python gen.py <test_case_size> <output_file>")
        sys.exit(1)
    
    n = int(sys.argv[1])
    output_file = sys.argv[2]
    
    test_case = generate_test_case(n)
    write_test_case(output_file, test_case)
    print(f"Generated test case with {n} elements to {output_file}")

if __name__ == "__main__":
    main()    